package main

import (
	"fmt"
	"sync"
)

var num int
var wg sync.WaitGroup


func add() {
	defer wg.Done()
	for i := 0; i < 10000; i++ {
		num++
	}
}
func sub() {
	defer wg.Done()
	for i := 0; i < 10000; i++ {
		num--
	}
}

func main() {
	wg.Add(2)
	go add()
	go sub()
	wg.Wait()
	fmt.Println(num)
}